package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/7/3 16:03
 * https://leetcode.cn/problems/hamming-distance/
 */
public class Title461 {

    public int hammingDistance(int x, int y) {
        int n = x ^ y;
        //计算二进制中1的个数
        int count = 0;
        while (n != 0) {
            count += n & 1;
            n = n >> 1;
        }
        return count;
    }

    public static void main(String[] args) {

    }
}
